import request from '@/utils/request'

const api = '/api/system/sysRole'

export default {
    getPageList(pageNo, pageSize, searchObj) {
        return request({
            url: `${api}/page/${pageNo}/${pageSize}`,
            method: 'get',
            params: searchObj
        })
    },
    removeByID(id) {
        return request({
            url: `${api}/remove/${id}`,
            method: 'delete',
        })
    },
    saveRole(role) {
        return request({
            url: `${api}/save`,
            method: 'post',
            data: role
        })
    },
    updateRole(role) {
        return request({
            url: `${api}/update`,
            method: 'put',
            data: role
        })
    },
    batchRemove(ids) {
        return request({
            url: `${api}/removeBatch`,
            method: 'delete',
            data: ids
        })
    },
    toAssign(roleID) {
        return request({
            url: `${api}/toAssign/${roleID}`,
            method: 'get'
        })
    },
    /*
查看某个角色的权限列表
*/
    toAssign(roleId) {
        return request({
            url: `${api}/toAssign/${roleId}`,
            method: 'get'
        })
    },

    /*
    给某个角色授权
    */
    doAssign(assginMenuVo) {
        return request({
            url: `${api}/doAssign`,
            method: "post",
            data: assginMenuVo
        })
    }
}